﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:bc="clr-namespace:FileExplorer.WPF.BaseControls"
    xmlns:conv="clr-namespace:QuickZip.Converters"       >

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/FileExplorer3.WPF;component/Themes/Default/Colors.xaml" />
        <ResourceDictionary Source="pack://application:,,,/FileExplorer3.WPF;component/Themes/Default/Brushes.xaml" />
        <ResourceDictionary Source="pack://application:,,,/FileExplorer3.WPF;component/Themes/Default/Geometry.xaml" />
        <ResourceDictionary Source="pack://application:,,,/FileExplorer3.WPF;component/Themes/Common/Converters.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <ControlTemplate x:Key="BaseToggleButton" TargetType="{x:Type ToggleButton}">
        <bc:HotTrack
            IsSelected="{TemplateBinding IsChecked}"
            SelectedBorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}"
            BorderThickness="{TemplateBinding BorderThickness}"
            >
            <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalAlignment}" 
                              VerticalAlignment="Center" Grid.RowSpan="2" />

        </bc:HotTrack>
    </ControlTemplate>

    <ControlTemplate x:Key="BasicArrowButton" TargetType="{x:Type ToggleButton}" >
        <Border x:Name="border"
                Padding="2,0" Background="Transparent" 
                BorderBrush="Transparent" BorderThickness="1" 
				MinHeight="20" MinWidth ="12" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
            <Path x:Name="path" Fill="{TemplateBinding Foreground}"
                    Data="{StaticResource NormalArrow}"
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center" 
                    Margin="{TemplateBinding Padding}" IsHitTestVisible="True" >
            </Path>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="IsPressed" Value="True">
                <Setter Property="Data" TargetName="path" Value="{StaticResource ExpandedArrow}"/>
            </Trigger>
            <Trigger Property="IsChecked" Value="True">
                <Setter Property="Data" TargetName="path" Value="{StaticResource ExpandedArrow}"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="ExpanderArrowButton" TargetType="{x:Type ToggleButton}" >
        <Border x:Name="border" 
                Padding="2,0" Background="Transparent" 
                BorderBrush="Transparent" BorderThickness="1"
				MinHeight="20" MinWidth ="12" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                
                <Path x:Name="path"  Stroke="Black" Fill="Black"
                    Data="{StaticResource NormalArrow}"
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center" 
                    Margin="{TemplateBinding Padding}" IsHitTestVisible="True" />
                <ContentPresenter x:Name="HeaderContent"
                          Grid.Column="1"
                          Margin="4,0,0,0"
                          ContentSource="Content"/>
            </Grid>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="IsPressed" Value="True">
                <Setter Property="Data" TargetName="path" Value="{StaticResource ExpandedArrow}"/>
            </Trigger>
            <Trigger Property="IsChecked" Value="True">
                <Setter Property="Data" TargetName="path" Value="{StaticResource ExpandedArrow}"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="ExpandCollapseToggleButton" TargetType="{x:Type ToggleButton}" >
        <!--<Border x:Name="border" Padding="5,5,5,5"
                Background="Transparent" 
                BorderBrush="Transparent" BorderThickness="1"
				Height="16" Width ="16" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
            <Path x:Name="ExpandPath"  Stroke="#FF989898" Fill="Transparent" StrokeThickness="1"
                    Data="{StaticResource TreeArrow}"                    
                    Margin="{TemplateBinding Padding}" IsHitTestVisible="True" >
                <Path.RenderTransform>
                    <RotateTransform Angle="135" CenterX="3" CenterY="3"/>
                </Path.RenderTransform>
            </Path>
        </Border>-->
        <Border Width="16" Height="16" Background="Transparent" Padding="5,5,5,5">
            <Path x:Name="ExpandPath" Fill="Transparent" Stroke="#FF989898" Data="{StaticResource TreeArrow}">
                <Path.RenderTransform>
                    <RotateTransform Angle="135" CenterX="3" CenterY="3"/>
                </Path.RenderTransform>
            </Path>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Stroke" TargetName="ExpandPath" Value="#FF1BBBFA"/>
                <Setter Property="Fill" TargetName="ExpandPath" Value="Transparent"/>
            </Trigger>
            <Trigger Property="IsChecked" Value="True">
                <Setter Property="RenderTransform" TargetName="ExpandPath">
                    <Setter.Value>
                        <RotateTransform Angle="180" CenterX="3" CenterY="3"/>
                    </Setter.Value>
                </Setter>
                <Setter Property="Fill" TargetName="ExpandPath" Value="#FF595959"/>
                <Setter Property="Stroke" TargetName="ExpandPath" Value="#FF262626"/>
            </Trigger>

        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style x:Key="ExpandCollapseToggleStyle" TargetType="{x:Type ToggleButton}">
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="Width" Value="16"/>
        <Setter Property="Height" Value="16"/>
        <Setter Property="Template" Value="{StaticResource ExpandCollapseToggleButton}" />
    </Style>

    <ControlTemplate x:Key="BlankButton" TargetType="{x:Type ButtonBase}">
        <Border BorderThickness="0" Background="Transparent">
            <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalAlignment}" 
                              VerticalAlignment="{TemplateBinding VerticalAlignment}" />
        </Border>
    </ControlTemplate>

    <ControlTemplate x:Key="BaseButton" TargetType="{x:Type ButtonBase}">
        <bc:HotTrack x:Name="HotTrack" SelectedBorderBrush="{TemplateBinding BorderBrush}"
                Padding="{TemplateBinding Padding}" Background="Transparent" 
                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                VerticalAlignment="{TemplateBinding VerticalAlignment}"
                HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                BorderThickness="{TemplateBinding BorderThickness}">
            <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
        </bc:HotTrack>

        <ControlTemplate.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter TargetName="HotTrack" Property="Background" 
                                Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
                <Setter TargetName="HotTrack" Property="Opacity" Value="0.4"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="BaseButtonHideOnDisabled" TargetType="{x:Type ButtonBase}">
        <bc:HotTrack x:Name="HotTrack" SelectedBorderBrush="{TemplateBinding BorderBrush}"
                Padding="{TemplateBinding Padding}" Background="Transparent" 
                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                BorderThickness="{TemplateBinding BorderThickness}">
            <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalAlignment}" 
                              VerticalAlignment="{TemplateBinding VerticalAlignment}" />
        </bc:HotTrack>

        <ControlTemplate.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Visibility" Value="Hidden" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="RoundedButton" TargetType="{x:Type ButtonBase}">
        <Border  CornerRadius="8" BorderThickness="{TemplateBinding BorderThickness}" 
                 BorderBrush="{TemplateBinding BorderBrush}">
            <Border.Clip>
                <MultiBinding Converter="{StaticResource bc}">
                    <Binding Path="ActualWidth"
                        RelativeSource="{RelativeSource Self}"/>
                    <Binding Path="ActualHeight"
                        RelativeSource="{RelativeSource Self}"/>
                    <Binding Path="CornerRadius"
                        RelativeSource="{RelativeSource Self}"/>
                </MultiBinding>
            </Border.Clip>
            <bc:HotTrack SelectedBorderBrush="{TemplateBinding BorderBrush}" x:Name="hotTrack"                 
                Padding="{TemplateBinding Padding}" Background="Transparent" 
                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                BorderThickness="0">
                <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalAlignment}"                                   
                              VerticalAlignment="{TemplateBinding VerticalAlignment}" />
            </bc:HotTrack>
        </Border>
    </ControlTemplate>


    <ControlTemplate x:Key="NavButton" TargetType="{x:Type ButtonBase}">
        <Grid Margin="3">
            <bc:Invert x:Name="cc" 
                       DisabledBackgroundBrush="{TemplateBinding Background}" 
                       DisabledForegroundBrush="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"
                       NormalBackgroundBrush="{TemplateBinding Background}" NormalForegroundBrush="{TemplateBinding Foreground}"
                       MouseOverBackgroundBrush="{TemplateBinding Foreground}" MouseOverForegroundBrush="{TemplateBinding Background}" >
                <Grid>
                    <Ellipse x:Name ="BackGrad" Height="25" Width="25" HorizontalAlignment="Center" 
                        VerticalAlignment ="Center" StrokeThickness="1"             
                        Stroke ="{Binding Foreground, ElementName=cc}" Fill="{Binding Background, ElementName=cc}">
                    </Ellipse>                    
                    <ContentPresenter />
                </Grid>
            </bc:Invert>
        </Grid>    
        <ControlTemplate.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Opacity" Value="0.3" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="NavBaseButton" TargetType="{x:Type ButtonBase}">
        <Grid Margin="3">
            <bc:Invert x:Name="cc" 
                       DisabledBackgroundBrush="{TemplateBinding Background}" 
                       DisabledForegroundBrush="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"
                       NormalBackgroundBrush="{TemplateBinding Background}" NormalForegroundBrush="{TemplateBinding Foreground}"
                       MouseOverBackgroundBrush="{TemplateBinding Foreground}" MouseOverForegroundBrush="{TemplateBinding Background}" >
                <Grid>                 
                    <ContentPresenter />
                </Grid>
            </bc:Invert>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Opacity" Value="0.3" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>


    <!--<ControlTemplate x:Key="BaseBreadcrumbButton" TargetType="{x:Type ButtonBase}">
        <Border x:Name="border"
                Padding="{TemplateBinding Padding}"
				Background="Transparent" 
				BorderBrush="Transparent"                
                BorderThickness="1"				
				SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition MaxHeight="11"/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <Rectangle x:Name="UpperHighlight" Fill="#75FFFFFF" Visibility="Collapsed"/>
                <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Stretch" Grid.RowSpan="2" />
            </Grid>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter TargetName="border" Property="Background" Value="{DynamicResource {x:Static SystemColors.HotTrackBrushKey}}" />
                <Setter TargetName="UpperHighlight" Property="Visibility" Value="Visible" />
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
                <Setter TargetName="border" Property="Background" Value="{DynamicResource {x:Static SystemColors.ActiveCaptionBrushKey}}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Visibility" Value="Hidden" />
            </Trigger>

        </ControlTemplate.Triggers>
    </ControlTemplate>-->


</ResourceDictionary>